package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.VerifyCodeLogMapper;
import com.ruoyi.bizsys.domain.VerifyCodeLog;
import com.ruoyi.bizsys.service.IVerifyCodeLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 验证码记录Service业务层处理
 *
 * @author african-loan
 * @date 2021-10-28
 */
@Service
public class VerifyCodeLogServiceImpl extends ServiceImpl<VerifyCodeLogMapper,VerifyCodeLog> implements IVerifyCodeLogService {

    /**
     * 查询验证码记录
     *
     * @param id 验证码记录ID
     * @return 验证码记录
     */
    @Override
    public VerifyCodeLog selectVerifyCodeLogById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询验证码记录列表
     *
     * @param verifyCodeLog 验证码记录
     * @return 验证码记录
     */
    @Override
    public List<VerifyCodeLog> selectVerifyCodeLogList(VerifyCodeLog verifyCodeLog) {
        return this.list(new QueryWrapper<>(verifyCodeLog).last("order by id desc"));
    }

    /**
     * 新增验证码记录
     *
     * @param verifyCodeLog 验证码记录
     * @return 结果
     */
            @Override
    public int insertVerifyCodeLog(VerifyCodeLog verifyCodeLog) {
                                                                                                                                                                                                                                                                verifyCodeLog.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(verifyCodeLog);
    }

    /**
     * 修改验证码记录
     *
     * @param verifyCodeLog 验证码记录
     * @return 结果
     */
            @Override
    public int updateVerifyCodeLog(VerifyCodeLog verifyCodeLog) {
                                                                                                                                                                                                                                                                                                        verifyCodeLog.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(verifyCodeLog);
    }

    /**
     * 批量删除验证码记录
     *
     * @param ids 需要删除的验证码记录ID
     * @return 结果
     */
            @Override
    public int deleteVerifyCodeLogByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除验证码记录信息
     *
     * @param id 验证码记录ID
     * @return 结果
     */
    @Override
    public int deleteVerifyCodeLogById(Long id) {
        return baseMapper.deleteById(id);
    }

}
